﻿<Page x:Class="WpfAnimation.PageDoubleAnimationUsingPath"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" 
      d:DesignHeight="350" d:DesignWidth="500"
	Title="PageDoubleAnimationUsingPath">

    <Canvas>
        <Path Stroke="Black" StrokeThickness="1">
            <Path.Data>
                <PathGeometry Figures="M 10,10 C 10,10 10,100 100,100 200,200 400,10 400,300" />
            </Path.Data>
        </Path>
        <Path Stroke="Red" StrokeThickness="1">
            <Path.Data>
                <PathGeometry Figures="M 10,10   10,10 10,100 100,100 200,200 400,10 400,300" />
            </Path.Data>
        </Path>
        <Button  Width="50" Height="50"  Canvas.Left="-25" Canvas.Top="-25">
            <Button.RenderTransform>
                <TransformGroup>
                    <TranslateTransform  x:Name="tts"   X="0"  Y="0"/>
                    <RotateTransform x:Name="rotate"  Angle="0" />
                </TransformGroup>
            </Button.RenderTransform>
            <Button.Triggers>
                <EventTrigger RoutedEvent="Button.Click">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimationUsingPath Duration="00:00:05" Storyboard.TargetName="tts" Source="X" Storyboard.TargetProperty="X" >
                                <DoubleAnimationUsingPath.PathGeometry>
                                    <PathGeometry  Figures="M 10,10  C 10,10 10,100 100,100 200,200 400,10 400,300" />
                                </DoubleAnimationUsingPath.PathGeometry>
                            </DoubleAnimationUsingPath>
                            <DoubleAnimationUsingPath Duration="00:00:05"  Storyboard.TargetName="tts" Source="Y" Storyboard.TargetProperty="Y" >
                                <DoubleAnimationUsingPath.PathGeometry>
                                    <PathGeometry  Figures="M 10,10  C 10,10 10,100 100,100 200,200 400,10 400,300" />
                                </DoubleAnimationUsingPath.PathGeometry>
                            </DoubleAnimationUsingPath>
                            <!--<DoubleAnimationUsingPath Duration="00:00:05"  Storyboard.TargetName="rotate" Source="Angle" Storyboard.TargetProperty="Angle" >
                                <DoubleAnimationUsingPath.PathGeometry>
                                    <PathGeometry  Figures="M 10,10  C 10,10 10,100 100,100 200,200 400,10 400,300" />
                                </DoubleAnimationUsingPath.PathGeometry>
                            </DoubleAnimationUsingPath>-->

                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Button.Triggers>
        </Button>

    </Canvas>
</Page>
